Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Added Utils class #169

Merged
merged 2 commits into from
Jun 10, 2019
Merged

feat: Added Utils class #169

merged 2 commits into from
Jun 10, 2019

Conversation

somenath1435
Copy link
Collaborator

Fixes #164
Changes: I have added a utility class
It has two methods:
one to close keyboard.
Second to reset Shared Preferences.

editor.putString(Constant.CITY, "");
editor.putString(Constant.STATE, "");
editor.putString(Constant.ACHIEVEMENTS, "");
editor.apply();
Toast.makeText(this, "Logged Out", Toast.LENGTH_LONG).show();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put this also in utils file

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@atm1504 i don't think it's a good idea, since we can reset values for other purposes also(excluding logout)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The moment u call this, u r actually logging out first, then resetting the values. So, it would be a good habit to inform the user that he has been logged out.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before logout an alert dialog pops up.....After logout Toast is displayed...

@@ -318,29 +319,10 @@ private void setHeaderData() {

private void clearData() {
editor = preferences.edit();
//method to reset shared preferences
Utils.resetSharedPreferences(preferences, editor);
if (preferences.getBoolean(Constant.LOGIN_STATUS, false)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

@somenath1435 somenath1435 requested a review from atm1504 June 10, 2019 19:39
@atm1504 atm1504 merged commit bd7d8f9 into development Jun 10, 2019
@atm1504 atm1504 deleted the utils branch June 10, 2019 20:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create a different class for logout
2 participants